package cn.cpf.app.gobang.modal;

import cn.cpf.app.gobang.global.Config;

/**
 * <b>Description : </b> 棋盘位置
 * <p>
 * <b>created in </b> 2017
 * </p>
 *
 * @author CPF
 **/
public class Place {

	private static final Place[][] placePool;

	static {
		placePool = new Place[Config.BOARD_LENGTH][Config.BOARD_LENGTH];
		for (int x = 0; x < Config.BOARD_LENGTH; x++){
			for (int y = 0; y < Config.BOARD_LENGTH; y++){
				placePool[x][y] = new Place(x, y);
			}
		}
	}

	public static Place of(int x, int y){
		return placePool[x][y];
	}

	public final int x;
	public final int y;

	private Place(int x, int y) {
		this.x = x;
		this.y = y;
	}

	@Override
	public String toString() {
		return "[" + x + "," + y + "]";
	}

}
